package struts2.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import dto.Curso;
import dto.Local;
import java.util.ArrayList;
import java.util.List;

public class ActionCarga
        extends ActionSupport implements Preparable {

    private List<Curso> cursoList;
    private List<Local> localList;
    /*estoy aumentado esta variable nueva al ActionData*/
    private List<Curso> cursoActualizado;

    public ActionCarga() {
    }

    public List<Curso> getCursoList() {
        return cursoList;
    }

    public void setCursoList(List<Curso> cursoList) {
        this.cursoList = cursoList;
    }

    public List<Local> getLocalList() {
        return localList;
    }

    public void setLocalList(List<Local> localList) {
        this.localList = localList;
    }

    @Override
    public String execute() throws Exception {
        return SUCCESS;
    }

    @Override
    public void prepare() throws Exception {
        cursoList = new ArrayList<Curso>();
        localList = new ArrayList<Local>();

        cursoList.add(new Curso(1, "Lenguaje Java"));
        cursoList.add(new Curso(2, "Visual Basic"));
        cursoList.add(new Curso(3, "HTML y CSS"));
        cursoList.add(new Curso(4, "Power Builder"));
        cursoList.add(new Curso(5, "MySQL Server"));
        cursoList.add(new Curso(6, "SO. Linux"));

        localList.add(new Local(1, "Miraflores"));
        localList.add(new Local(2, "La Molina"));
        localList.add(new Local(3, "Surquillo"));
        localList.add(new Local(4, "Pueblo Libre"));
        localList.add(new Local(5, "Barranco"));
    }
}
